<?php

class ViewList {
	
	final static function merge($template, $arr, $haveCleanRest = false, $separator = "\n") {
	    $erro = "Erro no merge do template {$template}! ";
	  	$output = "";
	    
	    if( is_array($arr) ){
	    	if( count($arr) > 0 ){
			    $output = "";
				foreach ($arr as $pos => $newArray) {
				    $row = new View( "_lists/" . $template );
				    foreach ($newArray as $key => $value)
				        $row->set($key, $value);
				    $output .= $row->output($haveCleanRest) . $separator;
				}
	    	}
	    	//else{
	    	//	$output .= $erro."Array vazio!";
	    	//}
	    }else{
	    	$output .= $erro."O teste 'is_array' falhou!";
	    }
			
	    return $output;
	}
}

?>